/* Turska UI library
 * Copyright 2003-2008 Jetro Lauha
 * All rights reserved.
 * Web: http://iki.fi/jetro/ or http://jet.ro
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of EITHER:
 *   (1) The GNU Lesser General Public License as published by the Free
 *       Software Foundation; either version 2.1 of the License, or (at
 *       your option) any later version. The text of the GNU Lesser
 *       General Public License is included with this library in the
 *       file LICENSE-LGPL.txt.
 *   (2) The BSD-style license that is included with this library in
 *       the file LICENSE-BSD.txt.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
 * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
 *
 * $Id: UIGraphicsIrr.h,v 1.1 2008/03/27 11:39:59 tonic Exp $
 * $Revision: 1.1 $
 */

#ifndef UIGRAPHICSIRR_H_INCLUDED
#define UIGRAPHICSIRR_H_INCLUDED


struct UIRectangle;


//! Implementation of the UIGraphics interface for Irrlicht.
class UIGraphicsIrr : public UIGraphics
{
public:

    UIGraphicsIrr(irr::IrrlichtDevice *device);
    virtual ~UIGraphicsIrr() {}

    // From UIGraphics:

    virtual void beginRender();
    virtual void endRender();

    //! Loads an image using a given file name.
    /*! Images are converted to textures and returned as UIImageIrr objects.
     */
    virtual UIImage * loadImage(const char *fileName,
                                UINT32 flags = UIImage::DEFAULT_FLAGS);

    // UIGraphicsIrr additions:

    virtual UIImage * loadImage(const char *name, irr::io::IReadFile *file, UINT32 flags = UIImage::DEFAULT_FLAGS);

    virtual UIImage * createUIImage(const char *name, irr::video::IImage *image, BOOL dropImage, UINT32 flags, UIRectangle *area = NULL);

    virtual irr::video::IImage * loadIrrImage(const char *fileName);
    virtual irr::video::IImage * loadIrrImage(irr::io::IReadFile *file);

    virtual BOOL createTexture(const char *name, irr::video::ITexture *&oTexture, irr::video::IImage *image,
                               UINT32 flags, irr::core::vector2df *oUV, UIRectangle *area = NULL);

    irr::IrrlichtDevice * getIrrDevice() { return mIrrDevice; }
    const irr::video::SMaterial & getDefaultMaterial() { return mDefaultMaterial; }

protected:

    irr::IrrlichtDevice *mIrrDevice;

    irr::video::SMaterial mDefaultMaterial;

private:

    UIGraphicsIrr();
};


#endif // !UIGRAPHICSIRR_H_INCLUDED
